package com.gateon.hw.system.provider;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gateon.hw.base.vo.Result;
import com.gateon.hw.client.system.client.UserClient;
import com.gateon.hw.client.system.req.UserAddReq;
import com.gateon.hw.client.system.req.UserListReq;
import com.gateon.hw.client.system.req.UserUpdateReq;
import com.gateon.hw.client.system.resp.UserResp;
import com.gateon.hw.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * user实体bean
 * Created by leslie on 2020-3-16 13:32:07
 */
@RestController
public class UserProvider implements UserClient {
    @Autowired
    private IUserService UserService;

    @Override
    public Result<Page<UserResp>> list(@RequestBody UserListReq req) {
        return UserService.list(req);
    }

    @Override
    public Result<UserResp> detail(@PathVariable("id") Long id) {
        return UserService.detail(id);
    }

    @Override
    public Result insert(@RequestBody UserAddReq req) {
        return UserService.add(req);
    }

    @Override
    public Result update(@RequestBody UserUpdateReq req) {
        return UserService.update(req);
    }

    @Override
    public Result delete(@PathVariable("id") Long id) {
        return UserService.delete(id);
    }
}
